package com.youth.feign.commodity;

import com.youth.entity.PageBean;
import com.youth.entity.vo.CommodityVO;
import com.youth.entity.vo.CountryVO;
import com.youth.result.ResultBean;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

/**
 * @ClassName CommodityFeignFactory
 * @Description: TODO
 * @Author yjwu
 * @Date 2019/10/31 21:43
 **/
@Component
@Slf4j
public class CommodityFeignFactory implements FallbackFactory<CommodityFeign> {
    @Override
    public CommodityFeign create(Throwable throwable) {
        return new CommodityFeign() {

            @Override
            public ResultBean add(CommodityVO commodityVO) {
                log.error("add fallback, reason was , {} ", throwable);
                return ResultBean.returnNetWorkBusyMsg();
            }

            @Override
            public ResultBean addByExcel(MultipartFile excel) {
                log.error("addByExcel fallback, reason was , {} ", throwable);
                return ResultBean.returnNetWorkBusyMsg();
            }


            @Override
            public ResultBean delete(String code) {
                log.error("delete fallback, reason was , {} ", throwable);
                return ResultBean.returnNetWorkBusyMsg();
            }

            @Override
            public ResultBean edit(CommodityVO commodityVO) {
                log.error("edit fallback, reason was , {} ", throwable);
                return ResultBean.returnNetWorkBusyMsg();
            }

            @Override
            public ResultBean decreaseStockNumber(String code, Integer soldNumber) {
                return null;
            }

            @Override
            public ResultBean findByCode(String code) {
                return null;
            }

            @Override
            public ResultBean findWithConditions(PageBean pageBean) {
                return null;
            }
        };
    }
}